//============================================================================
// Name        : Test.cpp
// Author      : 
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================
#include <stdint.h>
#include <iostream>
#include <cstdio>
using namespace std;

int main() {

	char charToGet[5] = {
			'a', 'b', 'c', 'd', 'e'
	};

	std::string charStr = "abcdeabcdeabcde123451234512345";
	int size = 5;
	int strSize = charStr.size();

	bool matches = true;
	int64_t count = 0;

	// Make sure that the character set (c) and the string input (s) is
	// positive in length.
	if(size <= 0 || strSize <= 0){
		return -1;
	}

	// Do not do distribution calculation on (c) if the following statement
	// is not true.  c|s
	if(strSize % size != 0){
		printf("Sizes do not match due to null termination of the string.\n");
		printf("Size: %d | strSize: %d | mod value: %d\n", size, strSize, strSize % size);
		return -1;
	}

	int64_t temp_numComparisons = strSize / size; //Guaranteed to be an integer

	// Loop for comparisons
	for(int i = 0; i < temp_numComparisons; i++){
		//Assume a match has been made
		count++;
		//Check for a match
		for(int j = 0; j < size; j++){
			printf("charToGet[%d]: %c | charStr[%d]: %c\n", j, charToGet[j], (i*size + j), charStr[i*size + j]);
			if(charToGet[j] != charStr[i*size + j]){
				count--;
				j = size;
			}
		}
	}

	double answer = ((double)count) / ((double)temp_numComparisons);
	printf("Count: %d, Total: %lld\n", count, temp_numComparisons);
	printf("Your prob is: %f\n", answer);

	return 0;
}
